<?php
// This view is showing all a specific users facade-site with information about
// the users ltest activity etc.


echo heading($user['first_name'] . " " . $user['last_name'], 2);
$properties = array(
			'src' => 'users/get_photo/'. $user['id'],
			'width' => '270',
			'height' => '270'
);

//Creating a table i the top of the page, with the profile-pic to the left,
//and private info to the right.
echo '<table border="0px solid black"><tr><td>';
echo img($properties,true);
echo '</td><td width="20px"></td><td valign="top">';
echo br();
$properties = array();

echo form_label('<b><big>username:</big></b> ', 'username');
echo $user['username'];

echo br(2);

echo form_label('<b><big>short bio:</big></b> ', 'bio');
echo br();
echo $user['bio'];

echo br(2);

echo form_label('<b><big>expertise/interests:</big></b> ', 'tags');
echo br();
//echo $user['tags'];

echo br();

echo form_label('<b><big>email:</big></b> ', 'email');

echo mailto($user['email'],$user['email']);

echo br(2);

echo form_label('<b><big>phone:</big></b> ', 'phone');

echo $user['phone'];

echo '</td></tr></table>';

echo br(2);

echo br();
$format = "%d/%m/%Y %h:%i %a";

echo '<hr size=3 width="80%">';

//Showing to users recent updates.
echo heading("Recent Updates", 3);
if ($user['id'] != $this->session->userdata('id')){

        //Checking if user is being following and offers to follow if not.
	if (in_array($user['id'],$following)){
		echo anchor("users/unfollow/".$user['id'], "stop following");
		echo br();
	}else{
		echo anchor("users/follow/".$user['id'], "follow status updates");
		echo br();
	}
}

//If the user have any update recently it will be showen here.
if (count($updates)){
	foreach ($updates as $key => $list){
		$U = $user['username'];
		$stamp = mysql_to_unix($list->created);
		echo "<p><b>".$U . ":</b><i> " . "&#8221;" .
					$list->update . "&#8221;</i>" .
					br() . "<small>".mdate($format,$stamp);

		echo "</small></p>";            
	}
        echo br();
}

echo '<hr size=3 width="80%">';
echo br();


//Showing to users recent Bookmark.
//If the user have added any bookmarks recently it will be showen here.
echo heading("Recent Bookmarks", 3);
if (count($bookmarks)){
	foreach ($bookmarks as $key => $list){
		$stamp = mysql_to_unix($list->created);
		echo "<p>" .
			auto_link($list->url) . br().
			"<small>added ".mdate($format,$stamp);
		echo "</small></p>";

	}
}else{
	echo "Sorry, no bookmarks by this user available!";
}
echo br();


echo '<hr size=3 width="80%">';

//Showing to users recent Posts.
//If the user have added any Posts (see 'Blog' in top-navigation-bar) recently it will be showen here.
echo heading("Recent Posts", 3);
if (count($posts))
{
    foreach ($posts as $key => $list)
    {
        $stamp = mysql_to_unix($list->created);
        echo "<p>" .
             anchor("blog/view_post/".$list->id,$list->title) . br().
             "<small>posted ".mdate($format,$stamp);
        echo "</small></p>";
    }
}
else
{
    echo "Sorry, no blog posts by this user available!";
}
echo br();

echo '<hr size=3 width="80%">';

//Showing to users recent files.
//If the user have added any files recently it will be showen here.
echo heading("Recent Files", 3);
if (count($files))
{
    foreach ($files as $key => $list)
    {
        $stamp = mysql_to_unix($list->created);
        echo "<p>" .
                anchor("files/view_file/".$list->id,$list->title) . br().
                "<small>uploaded ".mdate($format,$stamp);
        echo "</small></p>";

    }
}
else
{
    echo "Sorry, no files by this user available!";
}


?>